package com.perfma.xtest.tool;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: junhui.si
 * @date: 2020-11-30 16:36
 **/
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel("agent规则同步信息列表")
public class AgentVersionSyncVO implements Comparable<AgentVersionSyncVO> {
    @ApiModelProperty("agent唯一健")
    private String agentId;
    @ApiModelProperty("集群ip")
    private Long clusterId;
    @ApiModelProperty("机器ip")
    private String ip;
    @ApiModelProperty("已加载静/动态规则版本")
    private Long loadedVersion;
    @ApiModelProperty("agent状态。READY-未就绪，NOT_READY-已就绪")
    private VersionSyncState versionSyncState;

    public AgentVersionSyncVO(VersionSyncState versionSyncState) {
        this.versionSyncState = versionSyncState;
    }

    @Override
    public int compareTo(AgentVersionSyncVO o) {
        return o.versionSyncState.compareTo(this.versionSyncState);
    }

    /**
     * agent 规则同步状态
     */
    public enum VersionSyncState {
        /**
         * 同步
         */
        SYNC,
        /**
         * 未同步
         */
        NOT_SYNC,
        ;
    }
}
